<?php

require_once 'config/cfTrabalhos.php';

class dbConnection extends cfTrabalhos {

//    private $host = "localhost";
//    private $user = "root";
//    private $password = "";
//    private $dataBase = "trabalhos";

    private function Connect() {
        try {
            $conn = new PDO('mysql:host=localhost;dbname=trabalhos', 'root', '');
            return $conn;
        } catch (PDOException $i) {

            print "Erro: <code>" . $i->getMessage() . "</code>";
        }
    }

    public function RunQuery($sql) {
        $sta = $this->Connect()->prepare($sql);
        $sta->execute();
    }

    public function RunSelect($sql) {
        $sta = $this->Connect()->prepare($sql);
        $sta->execute();
        return $sta->fetchaAll(PDO::FETCH_ASSOC);
    }

}